<?php
namespace app\service;

class User extends Base
{
    /**
     * 根据session_id获取用户信息
     *
     * @param string $sessId
     * @return array
     */
    public static function getUserBySessId($sessId)
    {
        $str = static::redis()->get(static::$redisConfig['session_name'].$sessId);
        if ($str !== false) {
            static::redis()->expire(static::$redisConfig['session_name'].$sessId, ini_get('session.gc_maxlifetime'));
        }

        $session = static::parseSession($str);

        return isset($session['user']) ? $session['user'] : [];
    }
}